<?php
/**
 * User: Netman
 * Date: 14-3-27
 * Time: 下午9:53
 */

class Stourweb_Controller extends Class_Controller {

    /*
     * before
     */
    public function before()
    {
        parent::before();
        $url=Common::get_sys_para('cfg_supplier_logourl');
        if(stripos($url,St_Functions::get_http_prefix())===false){
            $url=St_Functions::get_http_prefix().$url;
        }
        $this->assign('webname',Common::get_sys_para('cfg_webname'));
        $this->assign('logo', Common::get_sys_para('cfg_supplier_logo'));
        $this->assign('logourl',$url);
        $this->assign('logotitle',Common::get_sys_para('cfg_supplier_logotitle'));
        $this->assign('footer',Common::get_sys_para('cfg_supplier_footer'));
        $this->assign('admindir', Common::get_sys_para('cfg_admin_dirname'));
        $this->assign('cmsurl',URL::site());

    }
    /*
   * 显示模板
   * @param string $tpl,模板名
   * */
    public function display($tpl)
    {
        $file = $GLOBALS['cfg_default_templet'].$GLOBALS['cfg_client_device'].'/'.$tpl;

        $view = Stourweb_View::factory($file);

        foreach($this->_data as $key=>$value)
        {
            //$view->set($key,$value);
            $view->set_global($key,$value);
        }

        $this->response->body($view->render());


    }

}